package com.ponhu.ea2.vo;

import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.ponhu.ea2.enums.ApplyCrowdEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;

import java.math.BigDecimal;

@Data
@NoArgsConstructor
@ColumnWidth(25)
public class PickInventoryExportVo extends PickExportVo {

    @ExcelProperty(value = "货品编码")
    private String inventoryCode; // 0

    @ColumnWidth(35)
    @ExcelProperty(value = "货品名称")
    private String inventoryName; // 1

    @ExcelProperty(value = "分类名称")
    private String categoryName;

    @ExcelProperty(value = "成色值")
    private String qualityValue;

    @ExcelProperty(value = "物料编码")
    private String materialCode;

    @ExcelProperty(value = "品牌名称")
    private String brandName;

    @ExcelProperty(value = "型号名称")
    private String modelName;

    @ExcelProperty(value = "系列名称")
    private String seriesName;

    @ExcelProperty(value = "标品/二奢")
    private String isSecondhand;

    @ExcelProperty(value = "货品成本（￥）")
    private BigDecimal inventoryCost;

    @ExcelProperty(value = "入库价（￥）")
    private BigDecimal warehousePrice;

    @ExcelProperty(value = "官网售价（￥）")
    private BigDecimal officialPrice;

    @ExcelProperty(value = "含税供货价（￥）")
    private BigDecimal supplyTaxPrice;

    @ExcelProperty(value = "含税销售价（￥）")
    private BigDecimal saleTaxPrice;

    @ColumnWidth(35)
    @ExcelProperty(value = "货品属性")
    private String propsStr; // 14

    @ColumnWidth(35)
    @ExcelProperty(value = "附件")
    private String annexStr; // 15

    @ColumnWidth(35)
    @ExcelProperty(value = "配件")
    private String accessoryStr; // 16

    @ExcelProperty(value = "适用人群")
    private String applyCrowd;

    @ExcelProperty(value = "原产地")
    private String provenance;

    @ExcelProperty(value = "单位")
    private String unit;

    @ExcelProperty(value = "上市时间")
    private String marketDate;

    @ExcelProperty(value = "鉴定师")
    private String appraiserName;

    @ColumnWidth(35)
    @ExcelProperty(value = "瑕疵")
    private String flaw; // 22

    @ColumnWidth(35)
    @ExcelProperty(value = "商品卖点")
    private String sellingPoint; // 23

    @ExcelProperty(value = "备注")
    private String remarks; // 24

    @ExcelProperty(value = "可售库存数")
    private Integer totalSalesStockNum;

    @ExcelProperty(value = "实物库存数")
    private Integer totalRealStockNum;

    @ExcelProperty(value = "调拨在途数")
    private Integer freeStockNum;

    @ColumnWidth(35)
    @ExcelProperty(value = "仓库位置")
    private String warehousePlace; // 28

    @ExcelProperty(value = "采购类型")
    private String procurementTypeName;

    @ExcelProperty(value = "采购渠道")
    private String channelName;

    @ExcelProperty(value = "供应商名称")
    private String suppName;

    @ExcelProperty(value = "入库方式")
    private String warehouseTypeName;

    @ExcelProperty(value = "异常信息")
    private String errorMsg;

    @ExcelProperty(value = "养护价（￥）")
    private BigDecimal maintenancePrice;

    @ExcelProperty(value = "检测结果")
    private String maintainResult;

    @ExcelProperty(value = "检测备注")
    private String maintainRemarks;

    public PickInventoryExportVo(String inventoryCode, String errorMsg) {
        this.inventoryCode = inventoryCode;
        this.errorMsg = errorMsg;
    }

    public String getApplyCrowd() {
        if (StringUtils.isEmpty(applyCrowd)) return applyCrowd;
        return ApplyCrowdEnum.getName(Integer.valueOf(applyCrowd));
    }

    public void setIsSecondhand(Integer isSecondhand) {
        if (ObjectUtils.isEmpty(isSecondhand)) return;
        this.isSecondhand = isSecondhand.toString();
    }

    public String getIsSecondhand() {
        if (StringUtils.isEmpty(isSecondhand)) return isSecondhand;
        return isSecondhand.equals("1") ? "二奢" : "标品";
    }

}
